package com.xca.znb.model.impl;

import android.content.Context;

import com.xca.znb.database.UserDAO;
import com.xca.znb.entity.Goods;
import com.xca.znb.entity.Order;
import com.xca.znb.model.imodel.IOrders;

import java.util.List;

public class OrdersImpl implements IOrders {
    private UserDAO userDAO ;
    public OrdersImpl(Context context){
        userDAO = new UserDAO(context) ;
    }

    @Override
    public List<Order> getAllOrderBuy(String phone) {
        return userDAO.getAllOrderBuy(phone);
    }

    @Override
    public List<Order> getOrderBuy(String phone, String type) {
        return userDAO.getOrderBuy(phone, type);
    }

    @Override
    public List<Order> getAllOrderSales(String phone) {
        return userDAO.getAllOrderSales(phone);
    }

    @Override
    public List<Order> getOrderSales(String phone, String type) {
        return userDAO.getOrderSales(phone, type);
    }

    @Override
    public void updateOrderType(int id, String type , String time) {
        userDAO.updateOrderType(id, type , time);
    }

    @Override
    public Goods getGoodsById(int id) {
        return userDAO.getGoodsById(id);
    }
    @Override
    public void insertAccount(String phone, double num, String type, String time_day, String time_sec) {
        userDAO.insertAccount(phone, num, type, time_day, time_sec);
    }

    @Override
    public Order getOrderById(int id) {
        return userDAO.getOrderById(id);
    }
}
